package top.xana.acg

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.appcompat.widget.AppCompatButton
import top.xana.acg.anime.utils.LogE

/**
 * @author lance
 * @date 2023/7/6 16:31
 * @description
 */
class TestButton @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : AppCompatButton(context, attrs, defStyleAttr) {
    companion object {
        private const val TAG = "TestButton"
    }

    override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
        when(event?.actionMasked) {
            MotionEvent.ACTION_DOWN -> LogE("down", TAG)
            MotionEvent.ACTION_MOVE -> LogE("move", TAG)
            MotionEvent.ACTION_UP -> LogE("up", TAG)
            MotionEvent.ACTION_CANCEL -> LogE("cancel", TAG)
        }
        return super.dispatchTouchEvent(event)
    }
}